/*
 * LDIR
 *
 * LDIR, a GPS cartography application built for Let's Do It Romania eco
 * campaign.
 * Copyright (C) 2010 Genera Software <office@generasoftware.com>
 *
 * http://generasoftware.com/
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA
 */
#ifndef LDIRLISTCACHE_H
#define LDIRLISTCACHE_H

#include <coecntrl.h>
#include <eiklbo.h>

class MEikCommandObserver;
class CEikFormattedCellListBox;


/**
 * Container class for LDIRMain
 *
 * @class    CLDIRMain LDIRMain.h
 */
class CLDIRListCache : public CCoeControl, MEikListBoxObserver
    {
public:
    // constructors and destructor
    CLDIRListCache();
    static CLDIRListCache* NewL( const TRect& aRect, const CCoeControl* aParent,
        MEikCommandObserver* aCommandObserver );
    static CLDIRListCache* NewLC( const TRect& aRect, const CCoeControl* aParent,
        MEikCommandObserver* aCommandObserver );
    void ConstructL( const TRect& aRect, const CCoeControl* aParent,
        MEikCommandObserver* aCommandObserver );
    virtual ~CLDIRListCache();
	void Delete();
	void DeleteAll();
	
public:
    // from base class CCoeControl
    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
    void HandleResourceChange( TInt aType );
    void PrepareEditL();

protected:
    // from base class CCoeControl
    void SizeChanged();
    TTypeUid::Ptr MopSupplyObject( TTypeUid aId );

    void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent anEventType );

private:
    // from base class CCoeControl
    void Draw( const TRect& aRect ) const;
    void SetIconArrayL();
    void CreateListEntriesL();

private:
    void InitializeControlsL();
    void LayoutControls();
    CCoeControl* iFocusControl;
    MEikCommandObserver* iCommandObserver;
    CAknsBasicBackgroundControlContext* iBackground;
    CEikFormattedCellListBox* iListBox;
    };

#endif // LDIRLISTCACHE_H
